package com.zx.lean_ui.Activity;

import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import com.zx.lean_ui.Adapter.MyAdapter;
import com.zx.lean_ui.R;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private ViewPager mainVp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        init_data();

    }

    private void init_data() {
        View view1 = getLayoutInflater().inflate(R.layout.layout1, null);
        View view2 = getLayoutInflater().inflate(R.layout.layout2, null);
        View view3 = getLayoutInflater().inflate(R.layout.layout3, null);
        List<View> views = new ArrayList<>();
        views.add(view1);
        views.add(view2);
        views.add(view3);
        MyAdapter myAdapter = new MyAdapter(views);
        mainVp.setAdapter(myAdapter);


    }

    private void initView() {
        mainVp = findViewById(R.id.main_vp);
    }
}